package com.desksoft.ecommerce.util.NoticeHelp;

import java.net.URLEncoder;
import java.util.Map;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;

public class SmsThread implements Runnable {

	private Map<String, Object> params;
	
	
	public Map<String, Object> getParams() {
		return params;
	}


	public void setParams(Map<String, Object> params) {
		this.params = params;
	}


	@Override
	public void run() {
		
		HttpClient httpclient = new org.apache.commons.httpclient.HttpClient();
		PostMethod method = new PostMethod((String)params.get("url"));
		method.addParameter("dccode", (String)params.get("dccode"));
		method.addParameter("eventid", (String)params.get("eventid"));
		method.addParameter("key", (String)params.get("key"));
		method.addParameter("mobile",(String)params.get("mobile") );
		method.addParameter("sendtime", (String)params.get("sendtime"));
//		method.addParameter("content", (String)params.get("content"));
//		method.addParameter("creater", (String)params.get("website"));
		
		try {
			method.addParameter("content", URLEncoder.encode((String)params.get("content"), "UTF-8"));
			method.addParameter("creater", URLEncoder.encode("website", "UTF-8"));
			httpclient.executeMethod(method);
		} catch (Exception e) {
			e.printStackTrace();
		}
		method.releaseConnection();

	}

}
